home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 4.iso
/
public
/
SciAn
/
src
/
ScianPointers.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-01
|
1KB
|
56 lines
/*ScianPointers.c
Eric Pepke
8 August 1993
Pointers in SciAn. A pointer is a variable that just contains an address.
SciAn doesn't pay any attention to the address; it's for use with system-
specific things, like function pointers or file pointers.
*/
#include "Scian.h"
#include "ScianTypes.h"
#include "ScianErrors.h"
#include "ScianPointers.h"
typedef struct
{
Thing thing; /* flags and stuff */
void *pointer; /* the actual pointer*/
} Pointer;
#ifdef PROTO
ObjPtr NewPointer(void *p)
#else
ObjPtr NewPointer(p)
void *p;
#endif
/*Creates a new pointer given p*/
{
Pointer *retVal;
retVal = (Pointer *) NewObject(NULLOBJ, sizeof(Pointer) - sizeof(Obj));
if (!retVal)
{
OMErr();
return NULLOBJ;
}
retVal -> thing . flags = OT_POINTER;
retVal -> pointer = p;
return (ObjPtr) retVal;
}
#ifdef PROTO
void *GetPointer(ObjPtr pointer)
#else
void *GetPointer(pointer)
ObjPtr pointer;
#endif
{
if (!pointer || !IsPointer(pointer))
{
ReportError("GetPointer", "Not a pointer");
return 0;
}
return ((Pointer *) pointer) -> pointer;
}